package com.longe.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
public class UserController {

    @RequestMapping("login")
    public String index(HttpServletRequest request, HttpServletResponse response){

        String userName = request.getParameter("userName");

        Cookie cookie1 = new Cookie("userName", userName);
        cookie1.setMaxAge(300);
        response.addCookie(cookie1);

        return "home";
    }
}
